/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       placed_event_trigger.h

	$Header: /game/placed_event_trigger.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( PLACED_EVENT_TRIGGER_H_INCLUDED )
#define PLACED_EVENT_TRIGGER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>

#include "stationary_adventure_object.h"

// --------------------------------------------------------------------------
// t_placed_event_trigger class
// --------------------------------------------------------------------------

class t_placed_event_base : public t_stationary_adventure_object
{
public:
	explicit t_placed_event_base( std::string const& model_name );

	std::string const &	get_event_name() const;
	virtual int			get_version() const;
	virtual bool		is_visible_to( int team_num ) const;
	virtual bool		read( std::streambuf &					 stream, 
							  t_qualified_adv_object_type const& type,
							  int								 version );
	virtual bool		read_from_map(
							std::streambuf &		stream,
							t_progress_handler *	handler );
	virtual bool		trigger_event( t_army& army );
	virtual bool		write( std::streambuf & stream ) const;

private:
	// Data members
	std::string	m_event_name;
};

class t_placed_event_trigger : public t_placed_event_base
{
public:
	explicit t_placed_event_trigger( std::string const& model_name );

	virtual bool				blocks_army(	t_creature_array const&			army,
												t_path_search_type		path_type ) const;

	virtual bool				is_triggered_by( t_creature_array const& army ) const;

	// Overrides to prevent drawing
	virtual t_screen_rect		get_shadow_rect() const;
	virtual t_screen_rect		get_shadow_rect( t_uint32 current_time ) const;
	virtual int					get_subimage_count() const;
};

class t_adv_object_pandoras_box : public t_placed_event_base
{
public:
	// Constructor
	explicit t_adv_object_pandoras_box( std::string const &	source );

	void				activate_trigger( t_army* army, t_adv_map_point const& point,
							t_direction direction, t_adventure_frame* frame );

	virtual bool		blocks_army(	t_creature_array const&		army,
										t_path_search_type	path_type ) const;

	virtual bool		is_triggered_by( t_creature_array const& army ) const;
	virtual bool		is_visible_to( int team_num ) const;
};

// --------------------------------------------------------------------------
// t_placed_event_base class
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_placed_event_base::t_placed_event_base( std::string const &	source )
	:	t_stationary_adventure_object( source )
{
}

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline std::string const & t_placed_event_base::get_event_name() const
{
	return m_event_name;
}

// --------------------------------------------------------------------------
// t_adv_object_pandoras_box class
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_adv_object_pandoras_box::t_adv_object_pandoras_box( std::string const&	source )
	:	t_placed_event_base( source )
{
}

// --------------------------------------------------------------------------
// t_placed_event_trigger class
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_placed_event_trigger::t_placed_event_trigger( std::string const &	source )
	:	t_placed_event_base( source )
{
}

#endif // !defined( PLACED_EVENT_TRIGGER_H_INCLUDED )
